/**
 * @addtogroup bsc_hj1239_record_chl_impl
 * bsc_hj1239_record_chl_impl
 * @{
 */
/**
 * @file        bsc_hj1239_record_chl_impl.h
 * @brief       激活通道各接口实现
 * @note        XXXX
 * @author      靳普诏(puzhao.jin@hopechart.com)
 * @date        2023/10/21
 * @version     1.0

 * @par         修改日志
 * <table>
 * <tr><th>Date         <th>Version     <th>Author      <th> Description
 * <tr><td>2023/10/21   <td>1.0         <td>靳普诏       <td> 创建初始版本
 * @copyright 杭州鸿泉物联网技术股份有限公司
 */

#ifndef _BSC_HJ1239_RECORD_CHL_IMPL_H_
#define _BSC_HJ1239_RECORD_CHL_IMPL_H_

#include "bsc_hj1239/bsc_hj1239_chl_param_if.h"
#include "bsc_hj1239/bsc_hj1239_chl_plug_if.h"
#include "bsc_hj1239/bsc_hj1239_chl_session_if.h"
#include "bsc_hj1239/bsc_hj1239_chl_collect_if.h"
#include "bsc_hj1239/bsc_hj1239_chl_report_if.h"
#include "bsc_hj1239/bsc_hj1239_chl_param_if.h"

#include "bsc_hj1239/bsc_hj1239_chl_pack.h"

#include "mfc/mfc_serial_vir_bus.h"

#ifdef __cplusplus
extern "C"
{
#endif


typedef struct TBsHj1239RecordChlImplTag TBsHj1239RecordChlImpl;
struct TBsHj1239RecordChlImplTag 
{
PUBLIC
    IBsHj1239ChlPlug      *chl_plug_if;
    IBsHj1239ChlParam     *chl_param_if;
    IBsHj1239ChlSession   chl_session_if;
    IBsHj1239ChlReport    chl_report_if;
    IBsHj1239ChlCollect   chl_collect_if;
    

PRIVATE
    TBsHj1239ChlSessionOnStateChange OnStateChange_;
    TBsHj1239ChlSessionOnDataNotify  OnDataNotify_;
    
    TMfSerialVirBus *data_vir_bus_;
    
    UInt32 session_connect_start_tick_;
    UInt32 session_connect_fail_tick_;

    UInt8 record_timeout_s_;    ///< 注册等待超时时间，单位:s
    UInt8 record_step_;
    UInt8 logging_state_;    
    UInt8 session_state_;

    UInt8 buff_is_malloc_flag_;
    UInt16 session_rx_pos_;
    // UInt8  session_rx_buff_[BSC_HJ1239_STD_CHL_RECV_BUFF_SIZE];    // 统一由外部设置.要求独立buff
    // UInt8  session_encode_buff_[BSC_HJ1239_STD_CHL_ENCODE_BUFF_SIZE];   // 可以共用上报buff    
    UInt8  *session_rx_buff_;
    UInt8  *session_encode_buff_;
    UInt16 session_rx_buff_size_;
    UInt16 session_encode_buff_size_;
    
    TBsHj1239ChlPack packet_;
};


typedef struct TBsHj1239RecordChlParamTag TBsHj1239RecordChlParam;
struct TBsHj1239RecordChlParamTag
{
    IBsHj1239ChlPlug    *chl_plug_if;
    IBsHj1239ChlParam   *chl_param_if;
    TMfSerialVirBus     *data_vir_bus;

    UInt8  *session_rx_buff;
    UInt8  *session_encode_buff;
    UInt16 session_rx_buff_size;
    UInt16 session_encode_buff_size;
};


Int32 TBsHj1239RecordChlImplCreate(TBsHj1239RecordChlImpl *self, TBsHj1239RecordChlParam *param);

void TBsHj1239RecordChlImplDestroy(TBsHj1239RecordChlImpl *self);

#ifdef __cplusplus
}  ///< extern "C"
#endif

#endif  ///< _BSC_HJ1239_RECORD_CHL_IMPL_H_

/**
 * @}  Generated on "2023-10-21 14:01:45" by the tool "gen_hq_file.py >> V20230509_1" 
 */
